package com.tanggh.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.tanggh.dao.JobCategoryDao;
import com.tanggh.entity.JobCategory;

@Repository
public class JobCategoryDaoImpl extends GenericDaoImpl<JobCategory> implements JobCategoryDao {

	@Override
	public List<JobCategory> getCategoryByCode(String code) {
		String hql = "select * from JobCategory j where left(j.code,2)=:code";
		Query query = getSession().createSQLQuery(hql).addEntity(JobCategory.class)
		.setParameter("code", code);
		return query.list();
	}
}
